﻿namespace Future.IService
{
    /// <summary>
    /// 描述：缓存服务接口 系统依赖于缓存接口至于缓存如何实现 系统并不关心
    /// 创建人： yangkai
    /// 创建时间：2022/12/21 17:03:41
    /// </summary>
    public interface ICacheService
    {
        /// <summary>
        /// 设置缓存
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public void SetObject<T>(string key, T value) where T : class;

        /// <summary>
        /// 设置缓存
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="ExpirationTime"></param>
        public void SetObject<T>(string key, T value, int ExpirationTime) where T : class;

        /// <summary>
        /// 读取缓存
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <returns></returns>
        public T? GetObject<T>(string key) where T : class;

        /// <summary>
        /// 删除缓存
        /// </summary>
        /// <param name="key"></param>
        public void Remove(string key);
    }
}
